<!-- 网页头部 -->
<template>
  <header class="header-wrap">
    <div class="wrapper">
      <div class="title">
        <img src="../assets/image/title.svg" alt="头像" title="头像"/>
        <span>study and life</span>
      </div>
      <div class="tag" v-for="(item, index) in tag" :key="index">
        {{ item }}
        <div class="bg"></div>
      </div>
      <div class="login">
        <div class="avatar">
          <img src="../assets/image/avatar.png" alt="" />
        </div>
        <div class="info">
          <span>登录</span>
          <span>|</span>
          <span>注册</span>
        </div>
      </div>
    </div>
  </header>
</template>

<script>
import { ref } from "vue";
export default {
  name: "Header",
  setup() {
    const tag = ref([
      "首页",
      "文章",
      "音乐",
      "影视",
      "相册",
      "留言板",
      "聊天室",
      "购物",
    ]);
    return {
      tag,
    };
  },
};
</script>
<style lang='less' scoped>
.header-wrap {
  .wrapper {
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 100%;
    height: 70px;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid rgb(231, 231, 231);
    overflow: hidden;
    .title {
      margin-right: 100px;
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        width: 50px;
        height: 50px;
        margin-right: 20px;
      }
      span {
        font-size: 20px;
      }
    }
    .tag {
      position: relative;
      width: 80px;
      height: 70px;
      text-align: center;
      line-height: 70px;
      .bg {
        position: absolute;
        top: 68px;
        z-index: -1;
        width: 100%;
        height: 100%;
        background: rgb(218, 181, 181);
        transition: all 0.5s ease-in-out;
      }
    }
    .tag:nth-child(2) {
      .bg {
        background: rgb(182, 182, 231) !important;
      }
    }
    .tag:nth-child(4) {
      .bg {
        background: rgb(231, 228, 182) !important;
      }
    }
    .tag:nth-child(5) {
      .bg {
        background: rgb(231, 206, 182) !important;
      }
    }
    .tag:nth-child(6) {
      .bg {
        background: rgb(182, 231, 224) !important;
      }
    }
    .tag:nth-child(7) {
      .bg {
        background: rgb(182, 231, 182) !important;
      }
    }
    .tag:nth-child(8) {
      .bg {
        background: rgb(231, 182, 182) !important;
      }
    }
    .tag:nth-child(9) {
      .bg {
        background: rgb(231, 182, 227) !important;
      }
    }
    .tag:nth-child(10) {
      .bg {
        background: rgb(182, 231, 204) !important;
      }
    }
    .tag:hover {
      .bg {
        transform: translateY(-68px);
      }
    }
    .tag + .tag {
      margin-left: 20px;
    }
    .login {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-left: 20px;
      .avatar {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        overflow: hidden;
        margin-right: 20px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .info {
        font-size: 12px;
        display: flex;
        justify-content: center;
        align-items: center;
        span:nth-child(2) {
          margin: 0 5px;
        }
      }
    }
  }
}
</style>